package com.hiyee.platform.service;

import com.github.pagehelper.PageInfo;
import com.hiyee.platform.response.PageListResult;

import java.util.List;

/**
 * 基础 Service 业务类
 *
 * @author WangBin
 * @date 2021-11-05
 */
public class BaseService {
    /**
     * 生成列表数据返回格式
     *
     * @param dataList
     * @param page
     * @param pageSize
     * @return
     */
    protected PageListResult generaPageList(List<?> dataList) {
        PageInfo<?> pageInfo = new PageInfo<>(dataList);
        PageListResult pageListResult = new PageListResult();
        pageListResult.setList(pageInfo.getList());
        pageListResult.setTotal(pageInfo.getTotal());
        return pageListResult;
    }
}
